Imports Microsoft.VisualBasic

Public Class WebPageCommon
    Inherits System.Web.UI.Page

    Public Enum myVars
        Seq_CD
        CID
        viewtag
        mode
        PolicyNo
        Provider
        CName
        UserName
    End Enum

    Public Sub SetPageSecurity(ByVal mDiv As Object)
        Dim sec As New Secure
        Dim cfunc As New CIMSfunc

        sec.ParentPage = Me
        sec.SetPageAccess(Session("UserName"))

        If ViewState("mode") = "view" Then
            cfunc.FormDisable(mDiv)
        End If

        cfunc = Nothing
        sec = Nothing

    End Sub

    Public Sub InitVars()
        If Not IsNothing(Session("Seq_CD")) Then ViewState.Add("Seq_CD", Session("Seq_CD"))
        If Not IsNothing(Session("CID")) Then ViewState.Add("CID", Session("CID"))
        If Not IsNothing(Session("viewtag")) Then ViewState.Add("viewtag", Session("viewtag"))
        If Not IsNothing(Session("mode")) Then ViewState.Add("mode", Session("mode"))
        If Not IsNothing(Session("advisor")) Then ViewState.Add("advisor", Session("advisor"))
        'advisor

        If Not IsNothing(Session("PolicyNo")) Then
            ViewState.Add("PolicyNo", Session("PolicyNo"))
        End If
        If Not IsNothing(Session("Provider")) Then
            ViewState.Add("Provider", Session("Provider"))
        End If
        If Not IsNothing(Session("CName")) Then
            ViewState.Add("CName", Session("CName"))
        End If

        ViewState.Add("UserName", Session("UserName"))
        Session.Clear()
        Session.Add("UserName", ViewState("UserName"))
        Session.Add("advisor", ViewState("advisor"))
    End Sub

    Public Sub InitSessions()
        If Not IsNothing(ViewState("Seq_CD")) Then Session.Add("Seq_CD", ViewState("Seq_CD"))
        If Not IsNothing(ViewState("PolicyNo")) Then Session.Add("PolicyNo", ViewState("PolicyNo"))
        If Not IsNothing(ViewState("Provider")) Then Session.Add("Provider", ViewState("Provider"))
        If Not IsNothing(ViewState("CID")) Then Session.Add("CID", ViewState("CID"))
        If Not IsNothing(ViewState("CName")) Then Session.Add("CName", ViewState("CName"))
        If Not IsNothing(ViewState("viewtag")) Then Session.Add("viewtag", ViewState("viewtag"))
        If Not IsNothing(ViewState("mode")) Then Session.Add("mode", ViewState("mode"))

        ViewState.Clear()
    End Sub
End Class
